from pymodbus.client.sync import ModbusSerialClient as ModbusClient
import logging

#using pymodbus package
#test modbus tcp client

if __name__ == '__main__':
    logging.basicConfig()
    log = logging.getLogger()
    log.setLevel(logging.DEBUG)
    
    client = ModbusClient(method='rtu', port='COM1', timeout=1, baudrate=9600)
    print client.bytesize,client.parity, client.stopbits
    print client
    #mb_client.connect()
    rr = client.read_coils(1,1,1)

    
    print 'rr',rr.bits
    
    rr = client.read_input_registers(1,8,1)
    print rr